def findNum(a, num):
    if num >= len(a):
        data = -1
        return data
    else:
        data = a[num]
        return data
def getList(a):
    while True:
        num = input("请输入列表元素，结束输入请按q")
        if num == "q" or num == "Q":
            print("输入完成")
            break
        elif num.isdigit():
            num = int(num)
            a.append(num)
        else:
            print('请输入整数')
    return a
test = []
print('请输入列表')
getList(test)
print(test)
num1 = int(input('请输入数字'))
print(findNum(test,num1))
